package com.zmj.sy.mom.srv.aps.controller;

import com.zmj.sy.mom.srv.aps.bean.entity.base.Message;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseIdReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BasePageReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BasePageResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.usermessage.UserMessageGetResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.usermessage.UserMessageListResVo;
import com.zmj.sy.mom.srv.aps.service.UserMessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@Api(tags = "用户-消息")
@RestController
@RequestMapping("/userMessage")
public class UserMessageController {

    private final UserMessageService userMessageService;

    @ApiOperation("添加")
    @PostMapping("/add")
    public BaseResVo add(@RequestBody Message reqVo) {
        userMessageService.add(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("列表")
    @PostMapping("/page")
    public BasePageResVo<UserMessageListResVo> page(@RequestBody BasePageReqVo reqVo) {
        return userMessageService.page(reqVo);
    }

    @ApiOperation("未读列表")
    @PostMapping("/notReadList")
    public BasePageResVo<UserMessageListResVo> notReadList(@RequestBody BasePageReqVo reqVo) {
        return userMessageService.notReadList(reqVo);
    }

    @ApiOperation("已读")
    @PostMapping("/read")
    public BaseResVo read(@RequestBody BaseIdReqVo reqVo) {
        userMessageService.read(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("未读")
    @PostMapping("/notRead")
    public BaseResVo notRead(@RequestBody BaseIdReqVo reqVo) {
        userMessageService.notRead(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("详情")
    @GetMapping("/get")
    public UserMessageGetResVo get(BaseIdReqVo reqVo) {
        return userMessageService.get(reqVo);
    }






}
